package cn.iocoder.yudao.module.lfd.dal.mysql.banner;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.lfd.dal.dataobject.banner.LfdBannerDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.lfd.controller.admin.banner.vo.*;

/**
 * Banner Mapper
 *
 * @author chenxx
 */
@Mapper
public interface LfdBannerMapper extends BaseMapperX<LfdBannerDO> {

    default PageResult<LfdBannerDO> selectPage(LfdBannerPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<LfdBannerDO>()
                .betweenIfPresent(LfdBannerDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(LfdBannerDO::getPhoto, reqVO.getPhoto())
                .likeIfPresent(LfdBannerDO::getName, reqVO.getName())
                .orderByDesc(LfdBannerDO::getId));
    }

    default List<LfdBannerDO> selectList(LfdBannerExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<LfdBannerDO>()
                .betweenIfPresent(LfdBannerDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(LfdBannerDO::getPhoto, reqVO.getPhoto())
                .likeIfPresent(LfdBannerDO::getName, reqVO.getName())
                .orderByDesc(LfdBannerDO::getId));
    }

}
